package cn.xopencode.recordservice.provider.maintransformer;

import cn.xopencode.common.framework.vo.CommonResult;
import cn.xopencode.common.framework.vo.PageResult;
import cn.xopencode.recordservice.manager.maintransformer.MainTransformerRecordManager;
import cn.xopencode.recordservice.rpc.maintransformer.MainTransformerRecordRpc;
import cn.xopencode.recordservice.rpc.maintransformer.dto.MainTransformerRecordCreateDTO;
import cn.xopencode.recordservice.rpc.maintransformer.dto.MainTransformerRecordPageDTO;
import cn.xopencode.recordservice.rpc.maintransformer.dto.MainTransformerRecordUpdateDTO;
import cn.xopencode.recordservice.rpc.maintransformer.vo.MainTransformerRecordAdminPageVO;
import cn.xopencode.recordservice.rpc.maintransformer.vo.MainTransformerRecordPageVO;
import cn.xopencode.recordservice.rpc.maintransformer.vo.MainTransformerRecordUpdateVO;
import cn.xopencode.recordservice.rpc.robotroom.dto.AdminRecordPageDTO;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 主变巡检记录 RPC 实现类
 */
@DubboService(version = "${dubbo.provider.MainTransformerRecordRpc.version}")
public class MainTransformerRecordRpcImpl implements MainTransformerRecordRpc {
    @Autowired
    private MainTransformerRecordManager mainTransformerRecordManager;

    @Override
    public CommonResult<Integer> createMainTransformerRecord(MainTransformerRecordCreateDTO createDTO) {
        Integer result = mainTransformerRecordManager.createMainTransformerRecord(createDTO);
        return CommonResult.success(result);
    }

    @Override
    public CommonResult<PageResult<MainTransformerRecordPageVO>> pageMainTransformerRecord(MainTransformerRecordPageDTO pageDTO) {
        return CommonResult.success(mainTransformerRecordManager.pageMainTransformerRecord(pageDTO));
    }

    @Override
    public CommonResult<MainTransformerRecordUpdateVO> getMainTransformerRecordById(String id) {
        return CommonResult.success(mainTransformerRecordManager.getMainTransformerRecordById(id));
    }

    @Override
    public CommonResult<Integer> updateMainTransformerRecord(MainTransformerRecordUpdateDTO updateDTO) {
        Integer result = mainTransformerRecordManager.updateMainTransformerRecord(updateDTO);
        return CommonResult.success(result);
    }

    @Override
    public CommonResult<Integer> dealMainTransformerRecordException(String recordId) {
        return CommonResult.success(mainTransformerRecordManager.dealMainTransformerRecordException(recordId));
    }

    @Override
    public CommonResult<PageResult<MainTransformerRecordAdminPageVO>> getAdminPageMainTransformerRecord(AdminRecordPageDTO pageDTO) {
        return CommonResult.success(mainTransformerRecordManager.getAdminPageMainTransformerRecord(pageDTO));
    }
}
